package com.jysz.certificate.persistence.dao.core;

import java.util.Date;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import com.jysz.certificate.persistence.dao.AbstractBaseDao;
import com.jysz.certificate.persistence.enums.AttachmentType;
import com.jysz.certificate.persistence.model.core.Attachment;

/**
 *
 * @author xuxiaolong
 */
@Repository
public class AttachmentDao extends AbstractBaseDao<Attachment, Long> {
	
	public void delJob(Date date){

		Query query=getSession().createQuery("delete from Attachment a where a.type=? and uploadDate < ?");
		query.setInteger(0, AttachmentType.RELEASE.getIndex());
		query.setDate(1, date);
		query.executeUpdate();
		
	}

}
